<?php

/*********************************************************************************
 * Copyright (C) 2011-2013 X2Engine Inc. All Rights Reserved.
 * 
 * X2Engine Inc.
 * P.O. Box 66752
 * Scotts Valley, California 95067 USA
 * 
 * Company website: http://www.x2engine.com 
 * Community and support website: http://www.x2community.com 
 * 
 * X2Engine Inc. grants you a perpetual, non-exclusive, non-transferable license 
 * to install and use this Software for your internal business purposes.  
 * You shall not modify, distribute, license or sublicense the Software.
 * Title, ownership, and all intellectual property rights in the Software belong 
 * exclusively to X2Engine.
 * 
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EITHER 
 * EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF 
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT.
 ********************************************************************************/

/**
 * This is the model class for chart module controls
 *
 * @package X2CRM.modules.charts.models
 * @property string $dateRange
 */
class X2PipelineChartModel extends CModel {

	public $dateRange = 30;
	public $assignedTo = ''; //Yii::app()->user->getName();
	public $limitTo = 0;
	public $confidence = 4;

	function __construct() {
		$this->assignedTo = Yii::app()->user->getName();
	}

	/**
	 * Returns the static model of the specified AR class.
	 * @return Docs the static model class
	 */
	public static function model($className = __CLASS__) {
		return parent::model($className);
	}

	/**
	 * @return array the atribute names
	 */
	public function attributeNames() {
		return array('dateRange', 'assignedTo', 'limitTo', 'confidence');
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels() {
		return array(
			'dateRange' => Yii::t('charts', 'Date Range'),
			'assignedTo' => Yii::t('charts', 'Assigned To'),
			'limitTo' => Yii::t('charts', 'Limit To'),
			'confidence' => Yii::t('charts', 'Confidence')
		);
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules() {
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('dateRange,assignedTo,limitTo,confidence', 'safe'),
		);
	}

}